﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Raytracererer
{
    public struct Color
    {
        public double r;
        public double g;
        public double b;

        /// <summary>
        /// Monochrome
        /// </summary>
        public Color(double r, double g, double b)
        {
            this.r = r;
            this.g = g;
            this.b = b;
        }

        public Color(double col)
            : this(col, col, col)
        {
        }
        public static implicit operator System.Drawing.Color(Color c)
        {
            return System.Drawing.Color.FromArgb((int)(c.r * 255), (int)(c.g * 255), (int)(c.b * 255));
        }
        public static Color operator *(Color color1, Color color2)
        {
            return new Color(color1.r * color2.r, color1.g * color2.g, color1.b * color2.b);
        }
        public static Color operator *(Color color1, double factor)
        {
            return new Color(color1.r * factor, color1.g * factor, color1.b * factor);
        }
        public static Color operator *(double factor, Color color1)
        {
            return new Color(color1.r * factor, color1.g * factor, color1.b * factor);
        }
        public static Color operator +(Color color1, Color color2)
        {
            return new Color(color1.r + color2.r, color1.g + color2.g, color1.b + color2.b);
        }
    }
}
